﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
       
        static void Main(string[] args)
        {
            //1、学生类：学号、姓名、年龄
            //2、请选择：1、添加学生信息。2、查询学生信息，3、删除学生信息  4、退出
            //3、重复的学号不能添加。
            //4、查询学生信息功能中有：1、查询所有（按学号排序）2、按学号查询（查没有，则打印查无此学生）
            student stu = new student();
            ArrayList list = new ArrayList();
            student stu1 = new student("1","王一","14");
            student stu2 = new student("2", "王二", "15");
            student stu3 = new student("3", "王三", "16");
            student stu4 = new student("4", "王四", "17");
            student stu5 = new student("5", "王五", "18");
            student stu6 = new student("6", "王六", "19");
            student stu7 = new student("7", "王七", "20");
            student stu8 = new student("8", "王八", "21");
           
            list.Add(stu1);
            list.Add(stu2);
            list.Add(stu3);
            list.Add(stu4);
            list.Add(stu5);
            list.Add(stu6);
            list.Add(stu7);
            list.Add(stu8);
            list.Insert(1, stu8);
            Console.WriteLine("请输入：1.添加学生信息。2、查询学生信息，3、删除学生信息  4、退出");
            string  num = Console.ReadLine();
            if (num=="1")
            {
                Console.WriteLine("输入你的学号");
                string  a = Console.ReadLine();
                Console.WriteLine("输入你的姓名");
                string b = Console.ReadLine();
                Console.WriteLine("输入你的年龄");
                string c = Console.ReadLine();
                student stu9 = new student(a, b, c);
                list.Add(stu9);
            }
            else if (num=="2")
            {
                Console.WriteLine("输入你查询的编号,加前缀stu");
                string a = Console.ReadLine();
                Console.WriteLine(list.Contains("a"));
                for (int i = 0; i < list.Count; i++)
                {
                    student st = (student)list[i];
                    Console.WriteLine("学号:{0},姓名:{1},年龄:{2}", st.Id, st.Name, st.Age);
                }
            }
            else if (num=="3")
            {
                Console.WriteLine("输入你想删除的学生编号,加前缀stu");
                int a = Console.Read();
                list.RemoveAt(a);
            }
            else if (num=="4")
            {
                Console.WriteLine("已退出");
            }
           
                
               
            




        }
    }
}
